<!--上传文件-->
<link rel="stylesheet" href="__STATIC__/admin/css/edit_common.css">

<link rel="stylesheet"type="text/css"href="__STATIC__/admin/uploadify/uploadify.css" />

<link rel="stylesheet" type="text/css" href="__CSS__/plyr.css"/>
<style>
    #commodity_main input[type=text]{width: 98%;}
    #commodity_main input[type=file]{margin-bottom: 10px;}
    #commodity_main img{width: 120px;height: 120px;border-radius: 50%;background-color: #FFFFFF;border-color:#FFFFFF;}
</style>

<div id="commodity_details">
    <h1 style="margin-top: 0px!important;">
        <img src="__STATIC__/admin/img/ico.png">
        编辑视频
        <a href="javascript:history.go(-1);"><span><img src="__STATIC__/admin/img/return.png"></span></a>
    </h1>
    </h1>
</div>

<div class="page-content">
    <div class="row">
        <div class="col-xs-12">
            <!-- PAGE CONTENT BEGINS -->
            <form class="form-horizontal" role="form" method="post" url="{:url()}" id="edit_form">
                <input type="hidden" value="{$config['id']}" name="id">
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right"> 位置 </label>
                    <div class="col-sm-9">
                        <input type="text" class="col-xs-10 col-sm-5" value="{$config['note']}" readonly>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right"> 封面图片 </label>
                    <div class="col-sm-9">
                        <input id="file_upload"  type="file" multiple="true" >
                        <img id="upload_org_code_img" src="{$config['config_image']}" width="150" height="150">
                        <input id="file_upload_image" name="config_image" type="hidden" multiple="true" value="{$config['config_image']}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right"> 视频 </label>
                    <div class="col-sm-9">
                        <input id="file_upload2"  type="file" multiple="true" >
                        <input id="file_upload_image2" name="config_video" type="hidden" multiple="true" value="{$config['config_value']}">
                        <!--<div>-->
                            <!--<div class="row video" >-->
                                <!--<div tabindex="0" class="plyr plyr&#45;&#45;video plyr&#45;&#45;fullscreen-enabled plyr&#45;&#45;stopped plyr&#45;&#45;ready">-->
                                    <!--<div class="plyr__video-wrapper" style="cursor: pointer;">-->
                                        <!--<div class="plyr__captions"></div>-->
                                        <!--<video src="{$config['config_value']}" class="embed-responsive-item plyr&#45;&#45;setup" poster="" src="{$config['config_value']}">-->
                                            <!--<source id="upload_org_code_img2" src="{$config['config_value']}" type="video/mp4">-->
                                        <!--</video>-->
                                    <!--</div>-->
                                <!--</div>-->
                            <!--</div>-->
                        <!--</div>-->
                    </div>
                </div>

                <div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                        <button class="btn btn-info" type="button" id="li1_btn">
                            <i class="icon-ok bigger-110"></i>
                            保存
                        </button>
                    </div>
                </div>
            </form>
        </div><!-- /.col -->
    </div><!-- /.row -->
</div><!-- /.page-content -->

{load href="__STATIC__/admin/js/image.js" /}
<script>
    $(".spgl").addClass("active");

    $('#li1_btn').click(function(){
        $.ajax({
            type: 'POST',
            url: "{:url('')}",
            data: $('#edit_form').serialize(),
            dataType: "json",
            beforeSend: function() {
                $('#li1_btn').attr('disabled','true');
                $('#li1_btn').attr('value','上传中...');
            },
            success: function(data) {
                console.log(data);
                alert(data.message);
                if(0==data.status){
                    location.href = "{:url('ad/videoindex')}";
                }else{
                    $('#li1_btn').removeAttr('disabled');
                    $('#li1_btn').attr('value','保存');
                }
            }
        });
    });
</script>
